<template>
  <div>
    <h1>OPERATION DAWNSEEKER</h1>
    <el-button @click="getBooks">获取图书信息</el-button>
    <el-table
      :data="books"
      height="250"
      border
      style="width: 100%">
      <el-table-column
        prop="id"
        label="标题"
        width="180">
      </el-table-column>
      <el-table-column
        prop="name"
        label="图书名"
        width="180">
      </el-table-column>
      <el-table-column
        prop="author"
        label="作者"
        width="180">
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {

  name: 'BookList',
  data: function () {
    return {
      books: []
    }
  },
  created: function () {
    this.getBooks()
  },
  methods: {
    getBooks: function () {
      this.$axios.get('/api/book/list').then((res) => {
        this.books = res.data.data
      })
    }
  }

}
</script>

<style scoped>

</style>
